<?php
	$topCates = service_category::getTopCate(service_type::PRODUCT);
	$cache = new Cache_request();
	$currentID = $cache->get("currentID");
	$actionName = isset($actionName)?$actionName:'';
?>
<div class="leftMenu">
<div class="leftProductTitle"></div>
<div class="list">
    <ul>
		<?php foreach($topCates as $item):?>
        <li>
			<a class="topmenu<?php if($item['id']==$currentID){?> current3<?php };?>" href="
				<?php if(!service_category::hasChildren($item['id'])){
						if($actionName == 'newp'){echo service_uri::getCategory2Uri($item['id']);}else{echo service_uri::getCategoryUri($item['id']);}
					}else{echo 'javascript:void(0)';}
				?>"><?php echo $item['title'];?></a>
			<?php if(service_category::hasChildren($item['id'])):?>
				<ul class="displayNone">
				<?php $children = service_category::getChildren($item['id']);
					foreach($children as $child):?>
					<li class="secondMenu <?php if($child['id']==$currentID){?> current2<?php };?>"><span><img src="<?php echo public_path('images/icon.jpg');?>" /></span>
					<a href="<?php if($actionName == 'newp'){echo service_uri::getCategory2Uri($child['id']);}else{echo service_uri::getCategoryUri($child['id']);}?>"><?php echo $child['title'];?></a></li>
				<?php endforeach;?>
				</ul>
			<?php endif;?>
		</li>
		<?php endforeach;?>
	</ul>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
	$(".list ul li").click(function(){
		var that = $(this).find("ul");
		if(that.hasClass('displayNone')){
			that.show(300);
			that.removeClass('displayNone');
		}else{
			that.hide(300);
			that.addClass('displayNone');
		}
	});
	$("li.current2").parent().show().prev().addClass('current3');
});
</script>
